class Triangle implements IShape {
    Point ptA;
    Point ptB;
    Point ptC;
    private final double edgeA;
    private final double edgeB;
    private final double edgeC;

    public Triangle(Point ptA, Point ptB, Point ptC) {
        this.ptA = ptA;
        this.ptB = ptB;
        this.ptC = ptC;
        this.edgeA = Math.sqrt(Math.pow(ptB.x - ptC.x, 2) + Math.pow(ptB.y - ptC.y, 2));
        this.edgeB = Math.sqrt(Math.pow(ptA.x - ptC.x, 2) + Math.pow(ptA.y - ptC.y, 2));
        this.edgeC = Math.sqrt(Math.pow(ptA.x - ptB.x, 2) + Math.pow(ptA.y - ptB.y, 2));
    }

    public double getEdgeA() {
        return edgeA;
    }

    public double getEdgeB() {
        return edgeB;
    }

    public double getEdgeC() {
        return edgeC;
    }

    @Override
    public double perimeter() {
        return edgeA + edgeB + edgeC;
    }

    @Override
    public double area() {
        double s = perimeter() / 2;
        return Math.sqrt(s * (s - edgeA) * (s - edgeB) * (s - edgeC));
    }

    @Override
    public void draw() {
        System.out.println("绘制一个三角形，顶点坐标: A(" + ptA.x + ", " + ptA.y + "), B(" + ptB.x + ", " + ptB.y + "), C(" + ptC.x + ", " + ptC.y + ")");
    }
}